<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>图片垂直居中对齐的3种方法</title>
        <style>
            ul{
                list-style:none;
            }
            li{
                margin: 0;
            }
            .test_box {display:table-cell;width:200px;height:200px;vertical-align:middle;text-align:center;
                *float:left;*font-family:simsun;*font-size:200px;*line-height:1;
                border:1px solid #000000;
            }
            .test_box img {vertical-align:middle;}
            .test_box1 {width:200px;height:200px;overflow:hidden;text-align:center;font-size:0;border:1px solid #000000;}
            .test_box1 .hook {display:inline-block;width:0;height:100%;overflow:hidden;margin-left:-1px;font-size:0;line-height:0;vertical-align:middle;}
            .test_box1 img {vertical-align:middle;border:0 none;}
        </style>
    </head>
    <body>
        <h1>图片垂直居中对齐</h1>
        <p>来源:<a href="http://caibaojian.com/popular-css-snippets.html">http://caibaojian.com/popular-css-snippets.html</a></p>
        <div class="test_box">
            <img src="book.jpg" alt="" />
        </div>
        <div class="test_box1">
            <span class="hook"></span>
            <a href="http://blog.linxz.de/css_book/" target="_blank"><img src="book.jpg" alt="" /></a>
        </div>
    </body>
</html>